package zlx.springboot.jsp.Configuration;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置拦截器，宽展spring mcv的配置
 */
@Configuration
public class InterceptorConfig  implements WebMvcConfigurer {
    //添加拦截器
    /*@Override
    public void addInterceptors(InterceptorRegistry registry) {
        //new CustomerInteceptor()，需要使用那个拦截器对象进行拦截就new一个
        registry.addInterceptor(new CustomerInteceptor()).addPathPatterns("/**").excludePathPatterns("/abc");
    }*/

    //配置Controller的配置，发送hh将会重定向到/abc去
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addRedirectViewController("hh","/abc");
    }
}
